#include <iostream>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

int main ()
{
	string s;
	vector<string> v;

	//cin << s;	this is not correct since it will only get the *first* non-space continuous characters.
	//for example, when input = "I am a student.", s will be "I" after cin << s.
	getline(cin, s);

	char * current = NULL;
	current = strtok(const_cast<char *>(s.c_str()), " ");
	while(current != NULL) {
		v.push_back(current);
		current = strtok(NULL, " ");
	}

	while(v.size() != 0) {
		cout << v.back() << " ";
		v.pop_back();
	}

	cout << endl;
	return 0;
}
